﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace MvcCms.Service.Code
{
    public class MoneyHelpers
    {
        public static decimal GetPercentage(decimal percent, decimal total)
        {            
            if (percent == 0 || total == 0)
            {
                return 0m;
            }
            else
            {
                var percentToReturn = (percent / 100.00m) * total;
                return decimal.Round(percentToReturn, 2, MidpointRounding.AwayFromZero); 
            }
        }
    }
}
